package com.xuxin.nantai.presenter;

import com.xuxin.nantai.bean.BaseBean;
import com.xuxin.nantai.bean.CompleteBean;
import com.xuxin.nantai.contract.CompleteContract;
import com.xuxin.nantai.model.CompleteModel;

/**
 * Created by xu_xin
 * Created on 2020.06.08 0008
 */
public class CompletePresenter implements CompleteContract.Presenter {
    private CompleteModel model;
    private CompleteContract.View view;

    public CompletePresenter(CompleteContract.View view) {
        model = new CompleteModel();
        this.view = view;
    }

    @Override
    public void getComplete(String LoginName, String ProductInfo, String InspectorInfo, int PageIndex) {
        if (null != model) {
            model.getComplete(this, LoginName, ProductInfo, InspectorInfo, PageIndex);
        }
    }

    @Override
    public void delete(String loginName, String UserName, String Guid) {
        if (null != model) {
            model.delete(this, loginName, UserName, Guid);
        }
    }

    @Override
    public void onSuccess(CompleteBean completeBean) {
        if (null != view) {
            view.onSuccess(completeBean);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (null != view) {
            view.onSuccess(baseBean);
        }
    }

    /**
     * 以下内容复用
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}